package org.gemstone.panel;

import java.awt.Dimension;
import java.awt.Graphics;
import java.math.BigDecimal;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

import org.come.until.CutButtonImage;
import org.come.until.Util;
import org.gemstone.btn.GemstoneOperationBtn;
import org.gemstone.mouseListener.CancelMouseListener;

import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;

 

/**
 * 宝石合成面板
 *
 * @author Administrator
 *
 */
public class GemstoneOperationSynthesisPanel extends JPanel {

	private JLabel synthesisGemstone // 合成宝石
			;
	// 合成按钮
	private GemstoneOperationBtn synthesisBtn;
	private JLabel[] gemstoneNumber;// 第一颗宝石,第二颗宝石

	public GemstoneOperationSynthesisPanel() {

			this.setPreferredSize(new Dimension(310, 260));
	        this.setOpaque(false);
	        this.setLayout(null);

	        synthesisBtn = new GemstoneOperationBtn("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_BTNPUTONG, "合成",
	                UIUtils.TEXT_HY16, 7);
	        synthesisGemstone = new JLabel();
	        gemstoneNumber = new JLabel[2];
	        for (int i = 0; i < gemstoneNumber.length; i++) {
	            gemstoneNumber[i] = new JLabel();
	            gemstoneNumber[i].setOpaque(false);
	            gemstoneNumber[i].setBounds(84 + i * 79, 30, 53, 51);
	            gemstoneNumber[i].addMouseListener(new CancelMouseListener(i));
	            this.add(gemstoneNumber[i]);

	        }

	        synthesisGemstone.setOpaque(false);
	        synthesisBtn.setBtn(-1);
	        synthesisBtn.setIcon(CutButtonImage.getImage("skin/8100226/newbutton/aj1h.png", -1, -1));

	        synthesisGemstone.setBounds(125, 107, 53, 51);
	        synthesisBtn.setBounds(125, 228, 59, 24);

	        this.add(synthesisGemstone);
	        this.add(synthesisBtn);


	}

	private ImageIcon iconBack;

	private BigDecimal b = new BigDecimal("5000000");

	@Override
	protected void paintComponent(Graphics g) {
		// TODO Auto-generated method stub
		super.paintComponent(g);
			if (iconBack == null) {
	            iconBack = new ImageIcon("inkImg/newbackground/B266.png");
	        }
	        g.drawImage(iconBack.getImage(), 0, 0, 310, 260, this);

	        Util.drawMoney(g, 125, 220);
	        Util.drawPrice(g, b, 125, 200);

	}

	public JLabel[] getGemstoneNumber() {
		return gemstoneNumber;
	}

	public void setGemstoneNumber(JLabel[] gemstoneNumber) {
		this.gemstoneNumber = gemstoneNumber;
	}

	public JLabel getSynthesisGemstone() {
		return synthesisGemstone;
	}

	public void setSynthesisGemstone(JLabel synthesisGemstone) {
		this.synthesisGemstone = synthesisGemstone;
	}

	public GemstoneOperationBtn getSynthesisBtn() {
		return synthesisBtn;
	}

	public void setSynthesisBtn(GemstoneOperationBtn synthesisBtn) {
		this.synthesisBtn = synthesisBtn;
	}

	public ImageIcon getIconBack() {
		return iconBack;
	}

	public void setIconBack(ImageIcon iconBack) {
		this.iconBack = iconBack;
	}

	public BigDecimal getB() {
		return b;
	}

	public void setB(BigDecimal b) {
		this.b = b;
	}

}
